#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=5e5+5;
int n,k,a[N],ans=2000000000;
int f[N],q[N],top,s[N];
bool check(int x) {
	int ret=0;
	for(int i=1;i<=n;i++) s[i]=f[i]=0;
	for(int f2=1;f2<=n;f2++) {
		f[f2]=1;
		top=0;
		for(int i=n;i;i--) {
			if(a[i]>x) continue ;
			int l=1,r=top,mid;
			while(l<=r) {
				mid=(l+r)>>1;
				if(q[mid]+a[i]<=x) {
					f[i]=s[mid]+1;
					l=mid+1;
				} else r=mid-1;
			}
			if(a[i]+a[f2]<=x) ret=max(ret,f[i]);
			while(top&&q[top]>=a[i]) --top;
			q[++top]=a[i];
			s[top]=max(s[top-1],f[i]);
		}
		f[f2]=0;
	}
	return ret>=k;
}
signed main(){
	freopen("sub.in","r",stdin);
	freopen("sub.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	cin>>n>>k;
	for(int i=1;i<=n;i++) {
		cin>>a[i];
	}
	int l=0,r=2000000000,mid;
	while(l<=r) {
		mid=(l+r)>>1;
		if(check(mid)) {
			ans=mid;
			r=mid-1;
		} else l=mid+1;
	}
	cout<<ans;
	return 0;
}

